package com.bionic.CES.beans;

import java.io.Serializable;
import java.sql.Date;

public class Query implements Serializable {

    protected Integer queryId;
    protected Integer userId;
    protected Date openDate;
    protected Date finishDate;
    protected Double amount;
    protected String currencyFrom;
    protected String currencyTo;
    protected Double rateFrom;
    protected Double rateTo;
    protected String status;

    public Query() {
    }

    public Query(Integer queryId, Date openDate, Date finishDate, Double amount,
            String currencyFrom, String currencyTo, Double rateFrom,
            Double rateTo, String status, Integer userId) {
        this.queryId = queryId;
        this.openDate = openDate;
        this.finishDate = finishDate;
        this.amount = amount;
        this.currencyFrom = currencyFrom;
        this.currencyTo = currencyTo;
        this.rateFrom = rateFrom;
        this.rateTo = rateTo;
        this.status = status;
        this.userId = userId;
    }

    public Integer getQueryId() {
        return queryId;
    }

    public void setQueryId(Integer queryId) {
        this.queryId = queryId;
    }

    public Date getOpenDate() {
        return openDate;
    }

    public void setOpenDate(Date openDate) {
        this.openDate = openDate;
    }

    public Date getFinishDate() {
        return finishDate;
    }

    public void setFinishDate(Date finishDate) {
        this.finishDate = finishDate;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getCurrencyFrom() {
        return currencyFrom;
    }

    public void setCurrencyFrom(String currencyFrom) {
        this.currencyFrom = currencyFrom;
    }

    public String getCurrencyTo() {
        return currencyTo;
    }

    public void setCurrencyTo(String currencyTo) {
        this.currencyTo = currencyTo;
    }

    public Double getRateFrom() {
        return rateFrom;
    }

    public void setRateFrom(Double rateFrom) {
        this.rateFrom = rateFrom;
    }

    public Double getRateTo() {
        return rateTo;
    }

    public void setRateTo(Double rateTo) {
        this.rateTo = rateTo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId (Integer userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "Query [queryId=" + queryId + ", openDate=" + openDate
                + ", finishDate=" + finishDate + ", amount=" + amount
                + ", currencyFrom=" + currencyFrom + ", currencyTo="
                + currencyTo + ", rateFrom=" + rateFrom + ", rateTo=" + rateTo
                + ", status=" + status + ", user=" + userId + "]";
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((amount == null) ? 0 : amount.hashCode());
		result = prime * result
				+ ((currencyFrom == null) ? 0 : currencyFrom.hashCode());
		result = prime * result
				+ ((currencyTo == null) ? 0 : currencyTo.hashCode());
		result = prime * result
				+ ((finishDate == null) ? 0 : finishDate.hashCode());
		result = prime * result
				+ ((openDate == null) ? 0 : openDate.hashCode());
		result = prime * result + queryId;
		long temp;
		temp = Double.doubleToLongBits(rateFrom);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(rateTo);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		result = prime * result + ((userId == null) ? 0 : userId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Query))
			return false;
		Query other = (Query) obj;
		if (amount == null) {
			if (other.amount != null)
				return false;
		} else if (!amount.equals(other.amount))
			return false;
		if (currencyFrom == null) {
			if (other.currencyFrom != null)
				return false;
		} else if (!currencyFrom.equals(other.currencyFrom))
			return false;
		if (currencyTo == null) {
			if (other.currencyTo != null)
				return false;
		} else if (!currencyTo.equals(other.currencyTo))
			return false;
		if (finishDate == null) {
			if (other.finishDate != null)
				return false;
		} else if (!finishDate.equals(other.finishDate))
			return false;
		if (openDate == null) {
			if (other.openDate != null)
				return false;
		} else if (!openDate.equals(other.openDate))
			return false;
		if (queryId != other.queryId)
			return false;
		if (Double.doubleToLongBits(rateFrom) != Double
				.doubleToLongBits(other.rateFrom))
			return false;
		if (Double.doubleToLongBits(rateTo) != Double
				.doubleToLongBits(other.rateTo))
			return false;
		if (status == null) {
			if (other.status != null)
				return false;
		} else if (!status.equals(other.status))
			return false;
		if (userId == null) {
			if (other.userId != null)
				return false;
		} else if (!userId.equals(other.userId))
			return false;
		return true;
	}
}
